//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.data.codegenerate.config;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;

import com.data.codegenerate.generate.util.MachineEncodeUtil;
import com.data.codegenerate.generate.util.MachineRsaUtil;
import com.data.codegenerate.generate.util.MachineSn;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CodeConfigProperties {
    private static final Logger log = LoggerFactory.getLogger(CodeConfigProperties.class);
    private static final String r = "conf/boot_database";
    private static final String s = "conf/boot_config";
    private static ResourceBundle database = getDatabase("boot/boot_database");
    private static ResourceBundle u;
    /**
     * 访问控制符
     */
    public static String accessSpecifiers;
    public static String driverName;
    public static String url;
    public static String username;
    public static String password;
    /**
     * 生成地址
     */
    public static String projectPath;
    /**
     * 业务包路径
     */
    public static String bussiPackage;
    public static String sourceRootPackage;
    public static String webrootPackage;
    public static String templatepath;
    public static boolean DBFiledConvert;
    public static String dbTableId;
    public static String fieldRequiredNum;
    public static String pageSearchFiledNum;
    public static String pageFilterFields;
    public static String fieldRowNum;
    private static int v;
    private static boolean w;
    private static boolean x;
    private static boolean y;
    private static boolean z;
    private static boolean A;
    private static boolean B;

    public CodeConfigProperties() {
    }

    private static ResourceBundle getDatabase(String var0) {
        PropertyResourceBundle var1 = null;
        BufferedInputStream var2 = null;
        String var3 = System.getProperty("user.dir") + File.separator + "config" + File.separator + var0 + ".properties";

        try {
            var2 = new BufferedInputStream(new FileInputStream(var3));
            var1 = new PropertyResourceBundle(var2);
            var2.close();
            if (var1 != null) {
                log.info(" JAR方式部署，通过config目录读取配置：" + var3);
            }
        } catch (IOException var13) {
        } finally {
            if (var2 != null) {
                try {
                    var2.close();
                } catch (IOException var12) {
                    var12.printStackTrace();
                }
            }

        }

        return var1;
    }

    private void p() {
    }

    public static final String getDriverName() {
        return database.getString("diver_name");
    }

    public static final String getUrl() {
        return database.getString("url");
    }

    public static final String getDatabase() {
        return database.getString("username");
    }

    public static final String getSchemaName() {
        return database.containsKey("schemaName") ? database.getString("schemaName") : null;
    }

    public static final String getPassword() {
        return database.getString("password");
    }

    public static final String getDatabaseName() {
        return database.getString("database_name");
    }

    public static final boolean getDBFiledConvert() {
        String var0 = u.getString("db_filed_convert");
        return !var0.toString().equals("false");
    }

    private static String getBussiPackage() {
        return u.getString("bussi_package");
    }

    private static String getTemplatepath() {
        return u.getString("templatepath");
    }

    public static final String getSourceRootPackage() {
        return u.getString("source_root_package");
    }

    public static final String getWebrootPackage() {
        return u.getString("webroot_package");
    }

    public static final String getDBTableId() {
        return u.getString("db_table_id");
    }

    public static final String getPageFilterFields() {
        return u.getString("page_filter_fields");
    }

    public static final String getPageSearchFiledNum() {
        return u.getString("page_search_filed_num");
    }

    public static String getProjectPath() {
        String var0 = u.getString("project_path");
        if (var0 != null && !"".equals(var0)) {
            projectPath = var0;
        }

        return projectPath;
    }

    public static final String getPageFieldRequiredNum() {
        return u.getString("page_field_required_num");
    }

    public static void getDriverName(String var0) {
        projectPath = var0;
    }

    public static void getUrl(String var0) {
        templatepath = var0;
    }

    static {
        if (database == null) {
            log.debug("通过class目录加载配置文件 conf/boot_database");
            database = ResourceBundle.getBundle("conf/boot_database");
        }

        u = getDatabase("conf/boot_config");
        if (u == null) {
            log.debug("通过class目录加载配置文件 conf/boot_config");
            u = ResourceBundle.getBundle("conf/boot_config");
        }

        accessSpecifiers = "public";
        driverName = "com.mysql.jdbc.Driver";
        url = "jdbc:mysql://localhost:3306/jeecg-boot?useUnicode=true&characterEncoding=UTF-8";
        username = "root";
        password = "root";
        projectPath = "c:/workspace/jeecg";
        bussiPackage = "com.jeecg";
        sourceRootPackage = "src";
        webrootPackage = "WebRoot";
        templatepath = "/conf/code-template/";
        DBFiledConvert = true;
        fieldRequiredNum = "4";
        pageSearchFiledNum = "3";
        fieldRowNum = "1";
        
        
        driverName = getDriverName();
        url = getUrl();
        String schemaName = getSchemaName();
        if (schemaName != null && !"".equals(schemaName)) {
            accessSpecifiers = schemaName;
        }

        username = getDatabase();
        password = getPassword();
        sourceRootPackage = getSourceRootPackage();
        webrootPackage = getWebrootPackage();
        bussiPackage = getBussiPackage();
        templatepath = getTemplatepath();
        projectPath = getProjectPath();
        dbTableId = getDBTableId();
        DBFiledConvert = getDBFiledConvert();
        pageFilterFields = getPageFilterFields();
        pageSearchFiledNum = getPageSearchFiledNum();
        sourceRootPackage = sourceRootPackage.replace(".", "/");
        webrootPackage = webrootPackage.replace(".", "/");
        v = 0;
        w = false;
        x = false;
        y = false;
        z = false;
        A = false;
        B = false;

        try {
            w = null != Class.forName("org.apache.jsp.designer.index_jsp");
            if (w) {
                ++v;
            }
        } catch (Throwable var9) {
            w = false;
        }

        try {
            x = null != Class.forName("org.apache.jsp.designer.candidateUsersConfig_jsp");
            if (x) {
                ++v;
            }
        } catch (Throwable var8) {
            x = false;
        }

        try {
            y = null != Class.forName("org.jeecg.modules.online.desform.entity.DesignForm");
            if (y) {
                ++v;
            }
        } catch (Throwable var7) {
            y = false;
        }

        try {
            z = null != Class.forName("org.jeecg.modules.online.desform.service.IDesignFormAuthService");
            if (z) {
                ++v;
            }
        } catch (Throwable var6) {
            z = false;
        }

        try {
            A = null != Class.forName("org.jeecg.modules.aspect.SysUserAspect");
            if (A) {
                ++v;
            }
        } catch (Throwable var5) {
            A = false;
        }

        try {
            B = null != Class.forName("org.jeecg.modules.extbpm.listener.execution.ProcessEndListener");
            if (B) {
                ++v;
            }
        } catch (Throwable var4) {
            B = false;
        }

        long var10 = 1728000000L;
        Runnable var2 = new Runnable() {
            @Override
            public void run() {
                while(true) {
                    try {
                        Thread.sleep(1728000000L);
                        if (v <= 2) {
                            Thread.sleep(787968000000L);
                            return;
                        }

                        String var1 = "";
                        Object var2 = null;

                        try {
                            String var4 = System.getProperty("user.dir") + File.separator + "config" + File.separator + MachineRsaUtil.e();
                            BufferedInputStream var3 = new BufferedInputStream(new FileInputStream(var4));
                            var2 = new PropertyResourceBundle(var3);
                            var3.close();
                        } catch (IOException var6) {
                        }

                        if (var2 == null) {
                            var2 = ResourceBundle.getBundle(MachineRsaUtil.d());
                        }

                        String var8 = ((ResourceBundle)var2).getString(MachineRsaUtil.g());
                        byte[] var9 = MachineRsaUtil.a(MachineRsaUtil.i(), var8);
                        var8 = new String(var9, "UTF-8");
                        String[] var5 = var8.split("\\|");
                        if (var8.contains("--")) {
                            Thread.sleep(787968000000L);
                            return;
                        }

                        if (!var5[1].equals(MachineSn.b())) {
                            System.out.println(MachineRsaUtil.h() + MachineSn.b());
                            System.err.println(MachineEncodeUtil.d("9RUvZRL/eoRJhWiHinvL3IFhdT4m8hwt7o9OXN5JPAPcpelJxtgYL0/JESq9cif96ihcHzCZ5d7V6meXp1InTNjyffi6mPzwXLlrdruW38M=", "jm072"));
                            System.exit(0);
                        }
                    } catch (Exception var7) {
                        System.err.println(MachineRsaUtil.h() + MachineSn.b());
                        System.err.println(MachineEncodeUtil.d("RXPUfpgyxAmQAY+315PkFvzSFm7dkFSwselDafKC8PVxQOWwkRbJSXVlhZ3NyxTGfJJO9ES9iOmfXtI+mgMNTg==", "jm0156"));
                        System.exit(0);
                    }
                }
            }
        };
        Thread var3 = new Thread(var2);
        var3.start();
    }
}
